package com.yxh.www.author.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 系统用户对象关系表
 * </p>
 *
 * @author Yangxiaohui
 * @since 2020-05-09
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SmUserObjectRelation extends Model<SmUserObjectRelation> {

    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private String userId;

    /**
     * 对象ID
     */
    @TableField("object_id")
    private String objectId;

    /**
     * 对象类型（0：角色；1：组织）
     */
    @TableField("object_type")
    private String objectType;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    public SmUserObjectRelation() {
    }

    public SmUserObjectRelation(String userId, String objectId, String objectType) {
        this.userId = userId;
        this.objectId = objectId;
        this.objectType = objectType;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
